<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/xml" prefix="x"%>
<!DOCTYPE html>
<html>
    <head>

        <link href="${pageContext.request.contextPath}/res/css/main-style.css" rel="stylesheet" type="text/css" />
        <link href="${pageContext.request.contextPath}/res/css/animation-slide.css" rel="stylesheet" type="text/css" />
        <link href="${pageContext.request.contextPath}/res/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
        <link href="${pageContext.request.contextPath}/res/css/bootstrap-responsive.min.css" rel="stylesheet" type="text/css" />

        <script>var contextPath="${pageContext.request.contextPath}"</script>  
        <script language="JavaScript" src="${pageContext.request.contextPath}/scripts/Animation.js"></script>
        <script type="text/javascript" src="${pageContext.request.contextPath}/res/js/jquery-1.9.1.js"></script>
        <script type="text/javascript" src="${pageContext.request.contextPath}/res/js/bootstrap.min.js"></script>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>HOME PAGE</title>
    </head>
    <body>
        <div id="page-container">

            <div id="header">
                <div class="wrapper">
                    <div class="logo-container">
                        <a href="${pageContext.request.contextPath}"><img src="${pageContext.request.contextPath}/res/img/logo2.png"/></a>
                    </div>
                    <c:choose>
                        <c:when test="${empty sessionScope.USER_ID}">
                            <nav class="menu-container">
                                <a href="${pageContext.request.contextPath}">Home</a>
                                <a href="${pageContext.request.contextPath}/about-us.jsp">About us</a>
                                <a href="${pageContext.request.contextPath}/client/product_category.jsp">Products</a>
                                <a href="${pageContext.request.contextPath}/management/Register.jsp">Registry</a>
                            </nav>

                            <div id="home-login">

                                <form action="UserController?action=Login" method="POST">
                                    <table>
                                        <tr>
                                            <td colspan="1"><input type="text" name="txtUsername" id="home-username" class="home-login-textbox" placeholder="username" required/></td>
                                            <td colspan="1"><input type="password" name="txtPassword" id="home-password" class="home-login-textbox" placeholder="password" required/></td>
                                        </tr>
                                        <tr>
                                            <td>
                                                <c:if test="${not empty requestScope.USER_ERROR}">
                                                    <p class="home-login-validation">${requestScope.USER_ERROR}</p>
                                                </c:if>
                                            </td>
                                            <td>
                                                <input type="submit" id="home-login-button" class="btn btn-info home-login-button" value="Login"/><br/>
                                            </td>
                                        </tr>
                                    </table>
                                </form>
                            </div> <!-- END Home-login -->
                        </c:when>
                        <c:otherwise>
                            <nav class="menu-container">
                                <a href="${pageContext.request.contextPath}">Home</a>
                                <a href="${pageContext.request.contextPath}/about-us.jsp">About us</a>
                                <c:if test="${sessionScope.USER_ROLE=='admin'}">
                                    <a href="${pageContext.request.contextPath}/management/Admin.jsp">Admin page</a>
                                </c:if>
                                <a href="${pageContext.request.contextPath}/client/product_category.jsp">Products</a>
                            </nav>
                            <div id="personal-container">
                                <ul>
                                    <li class="my-account">
                                        <h3>Welcome ${sessionScope.USER_NAME}</h3>
                                        <h3><a href="UserController?action=Logout" method="POST">Log out</a></h3>
                                    </li>
                                </ul>
                            </div>
                        </c:otherwise>
                    </c:choose>
                    <div class="spacer" style="clear: both;"></div>
                </div>
            </div> <!-- end header -->
            <div id="middle-container">
                <div class="wrapper">
                    <div class="current-action">
                    </div>

                    <div id="main">
                        <div id="wrap-slider">
                            <div id="slider">
                                <img class="slide-box" src="res/img/slide1.jpg" />
                                <img class="slide-box" src="res/img/slide2.jpg" />
                                <img class="slide-box" src="res/img/slide3.png" />
                                <img class="slide-box" src="res/img/slide4.jpg" />
                            </div><!-- end #slider -->
                        </div><!-- end #wrap-slider  -->
                        <span id="prev-slide">Previous</span><span id="next-slide">Next</span>
                    </div><!-- end #main -->
                    <%-- <img class="main-big-bg" src="res/img/url1.png" /> --%>

                    <div class="spacer" style="clear: both;"></div>
                </div> <!-- /wrapper -->
            </div> <!-- /middle-content -->
            <div id="footer">
                <div class="wrapper">
                    <div id="footer-menu">
                        <ul>
                            <li><a href="${pageContext.request.contextPath}">Home</a></li>
                            <li><a href="${pageContext.request.contextPath}/about-us.jsp">About us</a></li>
                            <li><a href="${pageContext.request.contextPath}/contact-us.jsp">Contact</a></li>
                        </ul>
                    </div>
                    <div id="copy-right">
                        <p>
            	Copyright © 2013 Laptops. All rights reserved.<br>
                        </p>
                    </div>
                </div>
            </div> <!-- end footer -->
        </div>
    </body>
</html>
